#include <iostream>
#include "matrix.h"
using namespace std;

void displayMatrix(Matrix&);

int main()
{
	//Create Matrices
	Matrix m1(3,3);
	Matrix m2(3,3);
	Matrix m3(3,4);
	Matrix m4(4,5);

	//Display default matrices
	cout << "Default Matrices" << endl;
	displayMatrix(m1);
	cout << endl;
	displayMatrix(m2);
	cout << endl;
	displayMatrix(m2);
	cout << endl << "---------------------" << endl << endl;

	//Set values
	m1.setMatri3X3(9,4,5,7,2,3,4,5,2);
	m2.setMatri3X3(2,5,7,1,8,9,3,4,5);
	double m3V[12] = {10,1,7,4,2,9,2,4,9,1,6,15};
	m3.setMatrix(m3V);
	double m4V[20] = {2,6,3,4,8,3,1,2,3,9,7,8,5,6,4,3,2,5,0,9};
	m4.setMatrix(m4V);

	//Disply set matrices
	cout << "Set Matrices" << endl;
	displayMatrix(m1);
	cout << endl;
	displayMatrix(m2);
	cout << endl;
	displayMatrix(m3);
	cout << endl;
	displayMatrix(m4);
	cout << endl << "---------------------" << endl << endl;

	//Can Sum
	cout << "Sum Matrices" << endl;
	displayMatrix(m1.getSum(m2));
	//Can't Sum
	displayMatrix(m1.getSum(m3));
	cout << endl << "---------------------" << endl << endl;

	//Can Subtract
	cout << "Subtract Matrices" << endl;
	displayMatrix(m1.getDiff(m2));
	//Can't Subtract
	displayMatrix(m1.getDiff(m3));
	cout << endl << "---------------------" << endl << endl;

	//Mult by scalar
	cout << "Multiply by scalar" << endl;
	displayMatrix(m1.getProdScalar(5.0));
	cout << endl << "---------------------" << endl << endl;

	//Mult by matrix
	cout << "Multiply by matrix" << endl;
	//displayMatrix(m1.getProdMatrix(m2));
	displayMatrix(m2.getProdMatrix(m4));
	displayMatrix(m3.getProdMatrix(m4));
	cout << endl << "---------------------" << endl << endl;

	//Mult by scalar
	cout << "Transpose" << endl;
	cout << endl << "---------------------" << endl << endl;

	return 0;
}

void displayMatrix(Matrix &m)
{
	for(int i=0;i<m.getX();i++)
	{
		for(int j=0;j<m.getY();j++)
			cout << m.getValue(m.getY() * i + j) << '\t';
		cout << endl;
	}
}